#ifndef _STRAWGUI_COMPONENT_OBJECT_H_
#define _STRAWGUI_COMPONENT_OBJECT_H_

#include "sGUIObject.h"
#include "sNamedObject.h"
#include "sNamedObjectContainer.h"
#include "sComponent.h"
#include "sLinkTo.h"

#ifdef _EDITOR
#include "sRTTIObject.h"
#endif

namespace sgui
{
namespace res
{

class sComponentObject : public sNamedObject
{
private:
    CONTAINER_WRAPPER(sComponentObject)     m_child;
    sLinkTo<sComponent>                     m_component;
	math::sRectsf							m_rect;
public:
    sLinkTo<sComponent>& getComponent();
    const sLinkTo<sComponent>& getComponent() const;

	CONTAINER_WRAPPER(sComponentObject)& getChild();
	const CONTAINER_WRAPPER(sComponentObject)& getChild() const;

	math::sRectsf& getRect() { return m_rect; }
	const math::sRectsf& getRect() const { return m_rect; }

	inst::sComponentInstance* getInstance(sGUI& gui, inst::sComponentInstance* parent = NULL);

    void load(db::Record &file);
    void save(db::Record &file) const;
    void clear();
    virtual const std::wstring getClass() const = 0;

#ifdef _EDITOR
	void exportRTTI(rtti::sInfoList& list);
#endif

    sComponentObject(sGUI& gui, const std::wstring& name);
};

};
};

#endif